﻿using System.Collections.ObjectModel;
using System.ComponentModel;

namespace NielsHebling.UnitTestResultViewerForSL.Core.Data
{
    public class ViewResultData : INotifyPropertyChanged
    {       
        public string XapFileName { get; set; }        
        public int TestsTotal { get; set; }        
        public int TestsFailed { get; set; }        
        public int TestsIgnored { get; set; }        
        public string DateRun { get; set; }               
        public string Method { get; set; }        
        public string Result { get; set; }        
        public string Duration { get; set; }        
        public string Message { get; set; }        
        public string StackTrace { get; set; }

        #region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;
        public void NotifyPropertyChanged(string propertyName)
        {
            if (this.PropertyChanged != null)
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
        #endregion
    }

    public class ViewResultDataList : INotifyPropertyChanged
    {
        public int TestsTotal { get; set; }
        public int TestsFailed { get; set; }
        public int TestsIgnored { get; set; }

        private ObservableCollection<ViewResultData> _items;
        public ObservableCollection<ViewResultData> Items 
        {
            get
            {
                return _items;
            }
            set
            {
                if (value != null)
                {
                    _items = value;
                    NotifyPropertyChanged("Items");
                }
            }
        }

        public ViewResultDataList()
        {
            this.Items = new ObservableCollection<ViewResultData>();
        }

        #region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;

        public void NotifyPropertyChanged(string propertyName)
        {
            if (this.PropertyChanged != null)
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
        #endregion
    }
}
